package com.kmxd.ams.core.oss.template;

import com.kmxd.ams.core.common.enums.OssEnum;
import com.kmxd.ams.core.oss.bo.OssFile;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.InputStream;
import java.util.List;

/**
 * 文件操作实现基类
 *
 * @author ZuoLG
 */
public interface IOssSvc {

  /**
   * 上传文件
   *
   * @param file
   * @param path
   * @return
   * @throws Exception
   */
  public OssFile upload(MultipartFile file, OssEnum ossEnum, String path) throws Exception;

  /**
   * 文件上传
   * @param file
   * @param ossEnum
   * @param path
   * @return
   * @throws Exception
   */
  public OssFile upload(File file, OssEnum ossEnum, String path) throws Exception;

  /**
   * 上传文件
   *
   * @param file
   * @param path
   * @return
   * @throws Exception
   */
  public OssFile upload(MultipartFile file, OssEnum ossEnum, String path, String newFileName)
      throws Exception;

  OssFile upload(File file, OssEnum ossEnum, String path, String newFileName)
      throws Exception;

  /**
   * 删除文件或文件夹下的文件
   *
   * @param path
   * @return
   * @throws Exception
   */
  public boolean delete(String path);

  /**
   * 文件改名
   *
   * @param path
   * @param newName
   * @return
   */
  public String rename(String path, String newName);

  /**
   * 获取文件
   *
   * @param path
   * @return
   * @throws Exception
   */
  public File getFile(String path);

  /**
   * 复制文件，会覆盖
   *
   * @param src
   * @param target
   * @return
   * @throws Exception
   */
  public File copy(String src, String target) throws Exception;

  /**
   * 获取文件输入流
   *
   * @param path
   * @return
   */
  public InputStream getFileInputStream(String path);

  /**
   * 检查文件MD5
   *
   * @param md5 md5
   * @param fileName 文件名称
   */
  public String checkFileMd5(String md5, String fileName);

  /**
   * 导出zip包
   *
   * @param paths
   * @return
   */
  public OssFile exportZip(List<OssFile> paths);

  boolean exist(String path);

  String separator();

  /**
   * 创建文件目录
   *
   * @param dest
   * @return
   */
  boolean mkdir(String dest);

    String getSystemTempPath();
}
